//
//  GXDJDDetViewController.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/10/28.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "GXDJDDetViewController.h"

@interface GXDJDDetViewController ()

@property (nonatomic,strong)NSDictionary *dic;
@property (weak, nonatomic) IBOutlet UILabel *labName;
@property (weak, nonatomic) IBOutlet UILabel *labPrice1;
@property (weak, nonatomic) IBOutlet UILabel *labNum;
@property (weak, nonatomic) IBOutlet UILabel *labPrice2;
@property (weak, nonatomic) IBOutlet UILabel *labOrder;
@property (weak, nonatomic) IBOutlet UILabel *labDDH;
@property (weak, nonatomic) IBOutlet UILabel *labDate;
@property (weak, nonatomic) IBOutlet UILabel *labPayMent;
@property (weak, nonatomic) IBOutlet UIImageView *imagePhone;
@property (weak, nonatomic) IBOutlet UILabel *labUser;
@property (weak, nonatomic) IBOutlet UILabel *labPhone;

@property (weak, nonatomic) IBOutlet UILabel *labPlace;
@property (weak, nonatomic) IBOutlet UILabel *labRemark;

@end

@implementation GXDJDDetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self showNav:@"订单详情"];
    [self loadData];
    
}

- (void)loadUI{
    _labName.text = [_dic objectForKey:@"consignee"];
    _labPrice1.text = [_dic objectForKey:@"oddnum"];
    _labOrder.text = [_dic objectForKey:@"oddnum"];
    _labDDH.text = [_dic objectForKey:@"ordernumber"];
    _labPrice2.text = [_dic objectForKey:@"oddnum"];
    NSString *date = [_dic objectForKey:@"addtime"];
    NSString *time = [self getNewDate:date];
    _labUser.text = [_dic objectForKey:@"consignee"];
    _labDate.text = time;
    _labPlace.text = [_dic objectForKey:@"address"];
    
    _labPhone.text = [_dic objectForKey:@"phone"];
    NSString *ordertype = [_dic objectForKey:@"ordertype"];
    if ([ordertype integerValue] == 2) {
        _labPayMent.text = @"微信支付";
    }else if ([ordertype integerValue] == 3){
        _labPayMent.text = @"支付宝支付";
    }else if ([ordertype integerValue] == 4){
        _labPayMent.text = @"银联支付";
    }else if ([ordertype integerValue] == 5){
        _labPayMent.text = @"余额支付";
    }
    
    _labRemark.text = [_dic objectForKey:@"remark"];
    _imagePhone.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click)];
    [_imagePhone addGestureRecognizer:tap];
    
}

- (void)click{
    
}

//干洗详情
- (void)loadData{
    [SVProgressHUD show];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:_orderId forKey:@"id"];
    [parmas setObject:_merid forKey:@"merchantid"];
    
    NSString *url = [NSString stringWithFormat:@"%@/App/Ordermanage/detailscleaning",urlHead];
    [[AFHTTPSessionManager manager] GET:url parameters:parmas success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"干洗详情res:%@",responseObject);
        //        _array = [[responseObject objectForKey:@"result"] objectForKey:@"delivery"];
        _dic = [[responseObject objectForKey:@"result"] objectForKey:@"details"];
        [self loadUI];
        [SVProgressHUD dismiss];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
        [SVProgressHUD dismiss];
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
